/**
 * @Date 2023-02-04 10:14:02
 * @Remark
 */

// react
import React from "react";
// lib
import { Navigate } from "react-router-dom";
// components & widget
// style
// config
import { ROUTE_LOGIN_VIEW, ROUTE_MAIN_VIEW } from "project/config";
// script & methods & public
import logUtils from "utils/logUtils";
// store
import { observer } from "mobx-react";
import { userState } from "state/global";
// controller
// interface
// 其它

function Index() {
  const isLogin = userState.isLogin();
  // 根据状态自动重定向
  logUtils.info("访问Index - 是否登录", isLogin);
  // 访问页面
  const to = isLogin ? `/${ROUTE_MAIN_VIEW}` : `/${ROUTE_LOGIN_VIEW}`;

  return <Navigate to={to} replace={true} />;
}

export default observer(Index);
